<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>标题</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/buildUnit/common.css">
    <link rel="stylesheet" href="/statics/layui/font/font.css" media="all"/>
    <style type="text/css">
        html, body {
            height: 100%;
            overflow-y: auto;
        }
    </style>
</head>
<body>
    <div class="layui-fluid" style="width: 1400px;margin:0 auto;" >
        <fieldset class="layui-elem-field" style="margin-top: 20px;">
            <legend>审查机构遴选抽取数量设定</legend>
            <form class="layui-form layui-form-pane" lay-filter="formData">
               <div class="layui-field-box" style="margin-top: 20px;">
                   &nbsp;&nbsp;&nbsp;&nbsp; <font color="#dc143c" style="color: red;size: 72px;">*</font> 遴选时系统随机抽取满足条件的审图机构数量
               </div>
               <div class="layui-field-box">
                   &nbsp;&nbsp;&nbsp;&nbsp; <font color="#dc143c" style="color: red;size: 72px;">*</font> 修改之后仅影响之后的抽取程序，不影响历史抽取结果
               </div>
               <div class="layui-field-box">
                   <div class="layui-form-item">
                       <label class="layui-form-label" style="width: 120px;">当前抽取数量</label>
                       <div class="layui-input-inline">
                           <input type="text" name="value" id="value"  placeholder="输入抽取数量" lay-filter="formData"  class="layui-input">
                       </div>
                       <button class="layui-btn" lay-submit lay-filter="EXTARCT_NUMBER">保存设置</button>
                   </div>
               </div>
           </form>
        </fieldset>


        <fieldset class="layui-elem-field" style="margin-top: 20px;">
            <legend>审查机构遴选抽取模式设定</legend>
            <form class="layui-form layui-form-pane" lay-filter="formData">
            <div class="layui-field-box" style="margin-top: 20px;">
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 180px;">审查机构遴选抽取模式</label>
                    <div class="layui-input-inline layui-btn-group" style="width: 280px;">
                        <input type="radio" name="value" id="EXTARCT_MODEL0" value="RANDOM" title="系统随机抽取"/>

                        <input type="radio" name="value" id="EXTARCT_MODEL1" value="ASSIGN" title="买单方指定">
                    </div>
                    <button class="layui-btn" lay-submit lay-filter="EXTARCT_MODEL">保存设置</button>
                </div>
            </div>
            </form>
        </fieldset>


        <fieldset class="layui-elem-field" style="margin-top: 20px;">
            <legend>时间设定（政府买单）</legend>
            <form class="layui-form layui-form-pane" lay-filter="formData">
            <div class="layui-field-box" style="margin-top: 20px;">
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 60px;">当天</label>
                    <div class="layui-input-inline">
                        <select name="START_TIME" id="START_TIME" lay-search="" style="width: 50px;"  class="layui-form" lay-filter="selFilter">
                            <option value="">选择时间</option>
                            <option value="10:00">10:00</option>
                            <option value="10:30">10:30</option>
                            <option value="11:00">11:00</option>
                            <option value="11:30">11:30</option>
                            <option value="12:00">12:00</option>
                            <option value="12:30">12:30</option>
                            <option value="13:00">13:00</option>
                            <option value="13:30">13:30</option>
                            <option value="14:00">14:00</option>
                        </select>
                    </div>
                    <label class="layui-form-label" style="width: 300px; margin-left: -10px;">前（指定时间）启动遴选，报价截止时间 </label>
                    <div class="layui-input-inline">
                        <select name="END_TIME" id="END_TIME" lay-search="" style="width: 50px;" class="layui-form" lay-filter="selFilter">
                            <option value="">选择时间</option>
                            <option value="14:30">14:30</option>
                            <option value="15:00">15:00</option>
                            <option value="15:30">15:30</option>
                            <option value="16:00">16:00</option>
                            <option value="15:30">15:30</option>
                            <option value="17:00">17:00</option>
                            <option value="15:30">15:30</option>
                            <option value="18:00">18:00</option>
                        </select>
                    </div>
                    <label class="layui-form-label" style="width: 135px; margin-left: -10px;">超时视为放弃。</label>
                    <button class="layui-btn" lay-submit lay-filter="CHOOSE_TIME">保存设置</button>
                    <div class="layui-field-box" style="margin-top: 20px;">
                     <font color="#dc143c" style="color: red;size: 72px;">*</font> （启动遴选时间晚于指定时间时，报价截止时间为第二天的截止时间，节假日顺延。截止时间需晚于指定时间）
                    </div>
                </div>
            </div>
            </form>
        </fieldset>
    </div>
<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    layui.use(['form', 'sessionFun', 'configure', 'configureCom', 'laydate'], function () {
        window.$ = layui.$;
        var form = layui.form;
        var configure = layui.configure;
        var configureCom = layui.configureCom;
        configureCom.postDataAjax(configure.EXAMINE_CONFIG_ALL_URL).then(function(res){
            var list=res.list;
            for(var i=0;i<list.length;i++){
                if(list[i].paramKey=="EXTARCT_NUMBER"){
                    $("#value").val(list[i].paramValue);
                }
                if(list[i].paramKey=="EXTARCT_MODEL"){
                    if(list[i].paramValue == 'RANDOM'){
                        $("#EXTARCT_MODEL0").prop("checked","checked");
                        $("#EXTARCT_MODEL1").prop("checked",false);
                    }else{
                        $("#EXTARCT_MODEL0").prop("checked",false);
                        $("#EXTARCT_MODEL1").prop("checked","checked");
                    }
                }
                if(list[i].paramKey=="CHOOSE_START_TIME"){
                    $("#START_TIME").val(list[i].paramValue);
                    form.render('select','selFilter');
                }
                if(list[i].paramKey=="CHOOSE_END_TIME"){
                    $("#END_TIME").val(list[i].paramValue);
                    form.render('select','selFilter');
                }
            }
            form.render();
        });
        //审查机构遴选抽取数量设定提交
        form.on('submit(EXTARCT_NUMBER)', function (data) {
             var value=data.field.value;
             if(value==null||value==""){
                 top.layer.msg('请输入抽取数量！');
                 return false;
             }
            configureCom.postDataAjax(configure.EXAMINE_CONFIG_URL, {
                value: value,
                key:'EXTARCT_NUMBER',
                type:'EXTARCT'
            }).then(function (res) {
                if (res.code == 0) {
                    top.layer.msg('抽取数量设置成功！');
                } else {
                    top.layer.alert('设置失败，请重试！')
                }
            });
             return false;
        });

        //审查机构遴选抽取模式设定
        form.on('submit(EXTARCT_MODEL)', function (data) {
            var value=data.field.value;
            if(value==null||value==""){
                top.layer.msg('选择遴选抽取模式！');
                return false;
            }
            configureCom.postDataAjax(configure.EXAMINE_CONFIG_URL, {
                value: value,
                key:'EXTARCT_MODEL',
                type:'EXTARCT'
            }).then(function (res) {
                if (res.code == 0) {
                    top.layer.msg('遴选抽取模式设置成功！');
                } else {
                    top.layer.alert('设置失败，请重试！')
                }
            });
            return false;
        });


        //时间设定（政府买单）
        form.on('submit(CHOOSE_TIME)', function (data) {
            var endTime=data.field.END_TIME;
            var startTime=data.field.START_TIME;
            if(startTime==null||startTime==""){
                top.layer.msg('选择遴选启动时间！');
                return false;
            }
            if(endTime==null||endTime==""){
                top.layer.msg('选择遴选报价截止时间！');
                return false;
            }
            configureCom.postDataAjax(configure.EXAMINE_CONFIG_URL, {
                endTimeValue: endTime,
                startTimeValue:startTime,
                endTimeKey: 'CHOOSE_END_TIME',
                startTimeKey:'CHOOSE_START_TIME',
                type:'CHOOSE'
            }).then(function (res) {
                if (res.code == 0) {
                    top.layer.msg('恭喜您，设置成功！');
                } else {
                    top.layer.alert('设置失败，请重试！')
                }
            });
            return false;
        });





    });
</script>
</body>
</html>
